package pharao.client.views.game.landkarte.ort.training;

import java.util.Iterator;
import java.util.List;

import pharao.client.views.game.landkarte.ort.lesson.Lesson;

import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

public class Training extends VerticalPanel {
	
	/**
	 * enthält alle Übungsaufgaben
	 */
	private List listLessons;
	
	public Training(List listLessons) {
		addLessons(listLessons);
		setStylePrimaryName("borderPanel");
	}
	
	/**
	 * fügt die Liste mit lessons der page hinzu
	 * @param listLessons
	 */
	public void addLessons(List listLessons) {
		
		setListLessons(listLessons);
		
		/*
		 * Liste mit Aufgaben hinzufügen
		 */
		Iterator iterator = listLessons.iterator();
		while (iterator.hasNext()) {	
			Widget widget = (Widget) iterator.next();
			add(widget);
		}
	}

	public void checkEntrys() {		
		Iterator iterator = getListLessons().iterator();
		while (iterator.hasNext()) {
			Lesson lesson = (Lesson) iterator.next();
			lesson.checkEntry();
		}
	}

	public List getListLessons() {
		return listLessons;
	}

	private void setListLessons(List listLessons) {
		this.listLessons = listLessons;
	}

}
